package org.yinxue.swing.im.ui;

import org.yinxue.swing.im.client.IMClient;
import org.yinxue.swing.im.domain.event.EventPublisher;

import javax.swing.*;

import static org.yinxue.swing.core.util.SwingUtils.*;

public class Main {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            IMClientPanel imUi = new IMClientPanel();
            EventPublisher.instance().register(imUi);

            IMClient imClient = new IMClient().connectServer();
            EventPublisher.instance().register(imClient);

            initDefaultUI();
            JFrame jFrame = ofJFrameWithMenuBar("IM");
            jFrame.add(imUi);
            jFrame.setIconImage(ofImage("uc_logo.png"));
            jFrame.setVisible(true);
        });
    }
}
